package com.industry.framework.core.context;

import com.industry.framework.core.context.register.CoreRegisterContextInit;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;


/**
 * @Author nbZhuozh
 * @Date 2025-03-19  14:13
 **/
@Component
public class CoreApplicationAware extends CoreRegisterContextInit implements ApplicationContextAware {

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        CoreApplicationContext.setApplicationContext(applicationContext);
        // NOTES: 注册表，基于不同模块需要可重新定义相关方法
        register(applicationContext);

        System.out.println("\n" +
                "  _____     ___   ______ _____\n" +
                " |_   _|    | |  |  _   |  _  | \n" +
                "   | |   _ _| |  | | |  | | | | \n" +
                "   | |  | | | |  | | |  | | | | \n" +
                "  _| |_ | |_| |  | |_|  | |_| | \n" +
                " |_____||_____|  |______|_____| \n" +
                " :: IDOO ::                     (v1.0.0)\n" +
                "                                 \n" +
                " [INFO] Starting IdooApplication on " + System.getProperty("user.name") + " with PID " + ProcessHandle.current().pid() + "\n" +
                " [INFO] No active profile set, using default 'dev'\n" +
                " [INFO] Started IdooApplication in 1.8 seconds (JVM running for 2.3)\n"
        );
    }
}
